<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户登录</title>
    <link rel="stylesheet" href="HTML\css\styles1.css">
    <link rel="stylesheet" href="HTML\css\login.css">
</head>
<body>
    <div class="login-container">
        <h2>用户登录</h2>
        <form id="loginForm">
            <input type="text" id="username" placeholder="用户名" required>
            <input type="password" id="password" placeholder="密码" required>
            <button type="submit">登录</button>
        </form>
        <p class="link-text">没有账号？<a href="register.html">立即注册</a></p>
    </div>
    <script>
        document.getElementById('loginForm').addEventListener('submit', function(event) {
    event.preventDefault();
    const username = document.getElementById('username').value.trim();
    const password = document.getElementById('password').value.trim();

    if (!username || !password) {
        alert('用户名和密码不能为空！');
        return;
    }

    // 模拟登录成功跳转
    alert('登录成功！正在跳转至主页...');
    window.location.href = 'index.html';
});
    </script>
</body>
</html>